# Importing Data
NEITHERLANDS <- read_excel("C:/users/Biniam/Desktop/Documents/Academic/Thesis/Analysis Folder/Excel Files/Steel/TSA.xlsx",sheet = "Sheet1", range = "X1:X239")

# Checking the Imported Data
View(NEITHERLANDS)
# Creating Time Series Data
NEITHERLANDS_ts <- ts(NEITHERLANDS, start=c(2000,1), end=c(2019,09), frequency=12)
# Viewing and Checking the Created Time Series Data
NEITHERLANDS_ts
sum(is.na(NEITHERLANDS_ts))
library(forecast)
NEITHERLANDS_ts <- tsclean(NEITHERLANDS_ts)
NEITHERLANDS_ts

# Identification: Plotting the Time Series Data
plot(NEITHERLANDS_ts)

# Estimating the appropriate model
NEITHERLANDS_ts_model <- auto.arima(NEITHERLANDS_ts)
NEITHERLANDS_ts_model

# Forecasting
options(max.print=1000000)
NEITHERLANDS_ts_forecast <- forecast (NEITHERLANDS_ts_model, level=c(95), h=255)
plot(NEITHERLANDS_ts_forecast)
NEITHERLANDS_ts_forecast             

# Exporting
write.table(NEITHERLANDS_ts_forecast, file="/users/Biniam/Desktop/Documents/Academic/Thesis/Result Folder/TSA Results/Excel Files/From R/Steel/NEITHERLANDS_TSA.csv", sep=",")
